﻿using Abp.AutoMapper;
using Abp.Dependency;
using Abp.Modules;
using Abp.Reflection.Extensions;
using AutoMapper;
using Hicap.QRCodeWarehouse.Application.Dto.Mapper;
using Hicap.QRCodeWarehouse.Core;
using Hicap.QRCodeWarehouse.Core.Managers;
using System;
using System.Collections.Generic;

namespace Hicap.QRCodeWarehouse.Application
{
    [DependsOn(
        typeof(QrCodeWarehouseCoreModule))]
    public class QrCodeWarehouseApplicationModule : AbpModule
    {
        public override void Initialize()
        {
            IocManager.RegisterAssemblyByConvention(typeof(QrCodeWarehouseApplicationModule).GetAssembly());
        }

        public override void PreInitialize()
        {
            base.PreInitialize();
            IocManager.Register<GenerationTaskManager>(DependencyLifeStyle.Transient);

            Configuration.Modules.AbpAutoMapper().Configurators.AddRange(
                new List<Action<IMapperConfigurationExpression>>()
                {
                    CustomerProductMapper.CreateMappings,
                    CustomerGenerationRuleMapper.CreateMappings,
                    CustomerGenerationTaskMapper.CreateMappings,
                    CustomerFileRepositoryMapper.CreateMappings,
                    CustomerMonitorMapper.CreateMappings
                });
        }
    }
}